<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1,maximum-scale=1,user-scalable=no"/>
    <title>项目添加页面</title>
    <link rel="stylesheet" type="text/css" href="../../static/admin/layui2/css/layui.css"/>
</head>
<body class="layui-layout-admin" >
<div class="layui-anim layui-anim-scale">
    <form class="layui-form layui-form-pane" name="form1" id="form1" style="margin-top: 20px;">
        <div class="layui-form-item">
            <label class="layui-form-label" style="width: 130px;">房间编码</label>
            <div class="layui-input-inline">
                <input type="text" name="fangjianbianma" id="fangjianbianma" autocomplete="off" class="layui-input" lay-verify="required" disabled>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label" style="width: 130px;">房间</label>
            <div class="layui-input-inline">
                <input type="text" name="fangjian" id="fangjian" autocomplete="off" class="layui-input" lay-verify="required" disabled>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label" style="width: 130px;">铺位编号</label>
            <div class="layui-input-inline">
                <input type="text" name="puweibianhao" id="puweibianhao" autocomplete="off" class="layui-input" lay-verify="required" disabled>
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label" style="width: 130px;">铺位</label>
            <div class="layui-input-inline">
                <input type="text" name="puwei" id="puwei" autocomplete="off" class="layui-input" lay-verify="required">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label" style="width: 130px;">使用状态</label>
            <div class="layui-input-block">
                <input type="radio" name="shiyongzhuangtai"  value="1" title="闲置">
                <input type="radio" name="shiyongzhuangtai"  value="2" title="锁定">
                <input type="radio" name="shiyongzhuangtai"  value="3" title="使用">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label" style="width: 130px;">启用状态</label>
            <div class="layui-input-block">
                <input type="radio" name="qiyongzhuangtai" id="open" value="1" title="启用">
                <input type="radio" name="qiyongzhuangtai" id="close" value="0" title="禁 用">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label" style="width: 130px;">可用面积</label>
            <div class="layui-input-inline">
                <input type="text" name="keyongmianji" id="keyongmianji" autocomplete="off" class="layui-input" lay-verify="required">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label" style="width: 130px;">租用面积</label>
            <div class="layui-input-inline">
                <input type="text" name="zuyongmianji" id="zuyongmianji" autocomplete="off" class="layui-input" lay-verify="required">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label" style="width: 130px;">备注</label>
            <div class="layui-input-inline" style="width: 400px">
                <textarea placeholder="请输入内容" class="layui-textarea" name="beizhu" id="beizhu"></textarea>
            </div>
        </div>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button type="submit" class="layui-btn" lay-submit="" lay-filter="demo1">修改</button>
            </div>
        </div>
    </form>
</div>
</div>
<script src="../../static/admin/layui2/layui.js" type="text/javascript" charset="utf-8"></script>
<script>
    layui.use(['element','form','jquery','layer','laydate'], function() {
        var element = layui.element
        var form = layui.form
        layer = layui.layer
        $ = layui.jquery;
        form.render('select');
        form.on('submit(demo1)',function(data){
            $.ajax({
                type:"POST",
                url:"/puwei/update",
                data:{
                    "fangjianbianma":data.field.fangjianbianma,
                    "fangjian":data.field.fangjian,
                    "puweibianhao":data.field.puweibianhao,
                    "puwei": data.field.puwei,
                    "qiyongzhuangtai":data.field.qiyongzhuangtai,
                    "shiyongzhuangtai":data.field.shiyongzhuangtai,
                    "keyongmianji":data.field.keyongmianji,
                    "zuyongmianji":data.field.zuyongmianji,
                    "beizhu":data.field.beizhu,
                },
                dataType:"json",
                success:function (res) {
                    if (res.flag) {
                        layer.msg('修改成功！',{icon:6,offset:"auto",time:2000});//提示框,提示2秒自动消失
                    }else  {
                        layer.msg('修改失败！'+res.data,{icon:5,offset:"auto",time:2000});//提示框
                    }
                    setTimeout(function(){
                        var index = parent.layer.getFrameIndex(window.name);
                        parent.layer.close(index);//关闭弹出层
                        parent.location.reload();//重新加载父页面表格
                    }, 2100);
                }
            })
            return false;
        });
    });
</script>
</body>
</html>